package com.example.freemarkdemo.ftpDemo;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: chenhao
 * \* Date: 2021/9/1
 * \* Time: 14:29
 * \* Description:
 * \
 */
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;


/**
 * 上传
 */
public class FtpUpMain {
    public static void main(String[] args) throws FileNotFoundException {
        //ftp服务器IP地址
        String ftpHost = "192.168.0.60";
        //ftp服务器端口
        int ftpPort = 21;
        //ftp服务器用户名
        String ftpUserName = "test";
        //ftp服务器密码
        String ftpPassword = "123456";
        //ftp服务器路径
        String ftpPath = "/home/test";
        //本地路径
        String localPath = "H://down";
        //文件名
        String fileName = "htdocs.zip";



        //上传
        //将E盘的文件上传至ftp根目录
        FileInputStream in=new FileInputStream(new File("e:/" + fileName));
        FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", fileName, in);


    }
}